{php include wl_template('common/header');}
<style type='text/css'>
	.order-rank img{width:16px; height:16px;}
	.js-remark,.js-admin-remark{word-break:break-all; overflow:hidden; background: #FDEEEE;color: #ED5050;padding: 5px 10px;}
	td.goods-info{position:relative; padding-left:60px;}
	.goods-info .img{position:absolute;top:50%; margin-top:-25px; background: url({IMAGE_LOADING}) center center no-repeat; width:50px;height:50px; }
	.goods-info span {white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;}
	.status-text{cursor:pointer;}
</style>
<ul class="nav nav-tabs">
	<li {if $_GPC['status']=='all'}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>'all'));}">全部活动{if $statusall}<span class="label label-warning pull-right" style="margin-left: 10px;">{$statusall}</span>{/if}</a></li>
	<li {if $_GPC['status']==1}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>1));}">待开始{if $status1}<span class="label label-warning pull-right" style="margin-left: 10px;">{$status1}</span>{/if}</a></li>
	<li {if $_GPC['status']==2}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>2));}">报名中{if $status2}<span class="label label-warning pull-right" style="margin-left: 10px;">{$status2}</span>{/if}</a></li>
	<li {if $_GPC['status']==3}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>3));}">报名结束{if $status3}<span class="label label-warning pull-right" style="margin-left: 10px;">{$status3}</span>{/if}</a></li>
	<li {if $_GPC['status']==9}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>9));}">下架中{if $status9}<span class="label label-warning pull-right" style="margin-left: 10px;">{$status9}</span>{/if}</a></li>
	<li {if $_GPC['status']==5}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>5));}">待审核{if $status5}<span class="label label-warning pull-right" style="margin-left: 10px;">{$status5}</span>{/if}</a></li>
	<li {if $_GPC['status']==4}class="active"{/if}><a href="{php echo web_url('activity/activity_web/activitylist',array('status'=>4));}">被驳回{if $status4}<span class="label label-warning pull-right" style="margin-left: 10px;">{$status4}</span>{/if}</a></li>
</ul>
<div class="app-content">
	<div class="app-filter">
		<div class="filter-action">
			<a href="{php echo web_url('activity/activity_web/createactivity')}" class="btn btn-primary">添加活动</a>
		</div>
		<div class="filter-list">
			<form action="" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{MODULE_NAME}" />
				<input type="hidden" name="p" value="activity" />
				<input type="hidden" name="ac" value="activity_web" />
				<input type="hidden" name="do" value="activitylist" />
				<div class="form-group">
					<label class="col-sm-2 control-label">关键字</label>
					<div class="col-md-3">
						<select name="keywordtype" class="form-control">
							<option value="">关键字类型</option>
							<option value="1" {if $_GPC['keywordtype']==1}selected="selected"{/if}>活动名称</option>
							<option value="2" {if $_GPC['keywordtype']==2}selected="selected"{/if}>活动ID</option>
							{if !is_store()}
							<option value="3" {if $_GPC['keywordtype']==3}selected="selected"{/if}>商家名称</option>
							{/if}
						</select>
					</div>
					<div class="col-md-4">
						<input type="text" name="keyword" class="form-control" value="{$_GPC['keyword']}"  placeholder="请输入关键字"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label"></label>
					<div class="col-sm-9">
						<button class="btn btn-primary" id="search">筛选</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<div class="app-table-list">
		<div class="order-list panel panel-default">
			<div class="panel-body table-responsive collapse in" id="order-template-item-4" style="padding: 0;">
				<table class="table table-hover table-bordered">
					<thead style="background-color: #FFFFFF;">
					<tr>
						<th style="width:30px;text-align:center;">ID</th>
						<th style="width:120px;">商品</th>
						<th style="width:100px; text-align:center;">报名时间</th>
						<th style="width:60px; text-align:center;">报名费/状态</th>
						<th style="width:60px; text-align:center;">属性</th>
						<th style="width:70px; text-align:center;">最多/最少人数</th>
						<th style="width:70px; text-align:center;">数据统计</th>
						<!--<th style="width:120px; text-align:center;">核销截止时间</th>-->
						<th style="width:100px; text-align:center;">操作</th>
					</tr>
					</thead>
					<tbody>
					{loop $lists $item}
					<tr>
						<td  class="text-center">
							<span>{$item['id']}</span>
						</td>
						<td class="goods-info line-feed">
							<div class="img"><img class="scrollLoading" src="{IMAGE_PIXEL}" data-url="{php echo tomedia($item['thumb'])}" height="50" width="50" onerror="this.src='{IMAGE_NOPIC_SMALL}'" ></div>
							<div class="title" style="padding-left: 60px;">
								<span>{$item['title']}</span>
								<span>商家:{$item['storename']}</span>
							</div>
						</td>
						<td class="line-feed" style="width:150px;padding-left: 5px;">
							<div class="title" style="text-align: center;">
								<span>从：{php echo date('m-d H:i',$item['enrollstarttime'])}</span><br />
								<span>到：{php echo date('m-d H:i',$item['enrollendtime'])}</span>
							</div>
						</td>
						<td class="text-center" style="width:60px;">
							{if $item['optionstatus'] > 0}
							<p style="color:orangered">￥{$item['minprice']} - ￥{$item['maxprice']}</p>
							{else}
							<p style="color:orangered">￥{$item['price']}</p>
							{/if}
							<p>{if $item['status'] == 0 }<span class="label label-warning">下架中</span>{/if}
								{if $item['status'] == 1 }<span class="label label-warning">未开始</span>{/if}
								{if $item['status'] == 2 }<span class="label label-success">报名中</span>{/if}
								{if $item['status'] == 3 }<span class="label label-danger">报名结束</span>{/if}
								{if $item['status'] == 4 }<span class="label label-danger">未通过</span>{/if}
								{if $item['status'] == 5 }<span class="label label-danger">待审核</span>{/if}</p>
						</td>
						<td class="text-center" style="width:60px;">
							<p>人气：<a style="color: #428bca;" data-href="{php echo web_url('activity/activity_web/changeinfo',array('id' => $item['id'],'type'=>1))}" href="javascript:;" title="修改人气" data-toggle="ajaxEdit" >{$item['pv']}</a></p>
							<p>排序：<a style="color: #428bca;" data-href="{php echo web_url('activity/activity_web/changeinfo',array('id' => $item['id'],'type'=>2))}" href="javascript:;" title="修改排序" data-toggle="ajaxEdit" >{$item['sort']}</a></p>
						</td>
						<td class="text-center" style="width:70px;">
							{if $item['optionstatus'] > 0}
							<p>多规格活动</p>
							{else}
							<p>{if $item['maxpeoplenum']}最多:<a style="color: #428bca;" data-href="{php echo web_url('activity/activity_web/changeinfo',array('id' => $item['id'],'type'=>3))}" href="javascript:;" title="修改人数" data-toggle="ajaxEdit" >{$item['maxpeoplenum']}</a>人{else}无限制{/if}</p>
							<p>{if $item['minpeoplenum']}最少:<a style="color: #428bca;" data-href="{php echo web_url('activity/activity_web/changeinfo',array('id' => $item['id'],'type'=>4))}" href="javascript:;" title="修改人数" data-toggle="ajaxEdit" >{$item['minpeoplenum']}</a>人{else}无限制{/if}</p>
							{/if}
						</td>
						<td class="text-center" style="width:70px;">
							<p style="color: #428bca;"><a href="{php echo web_url('order/wlOrder/checkcodeList',array('plugin'=>'activity','status'=>1,'id' => $item['id']))}">已报名：{$item['alreadypay']}</a></p>
							<p style="color: #428bca;"><a href="{php echo web_url('order/wlOrder/checkcodeList',array('plugin'=>'activity','status'=>3,'id' => $item['id']))}">已完成：{$item['alreadyuse']}</a></p>
						</td>
						<td class="text-center">
							{if p('wxplatform')}
							<a href="javascript:;" data-url="{php echo h5_url('pages/subPages2/coursegoods/coursegoods',['id'=>$item['id']])}" class="js-clip">复制链接</a>
							{/if}
							{if p('wxapp')}
							<a href="javascript:;" data-url="pages/subPages2/coursegoods/coursegoods?id={$item['id']}" class="js-clip">复制路径</a>
							{/if}
							<!--<p style="color: #428bca;display: inline-block;"><a href="javascript:;" class="js-copy" order-id="{$item['id']}">复制</a></p>-->
							<p style="color: #428bca;display: inline-block;"><a href="{php echo web_url('activity/activity_web/createactivity',array('id' => $item['id']))}">编辑</a> </p>
							<br />
							{if ($item['status'] == 1 || $item['status'] == 2 || $item['status'] == 3)}
							<p style="color: #428bca;display: inline-block;"><a href="javascript:;" class="js-remove" order-id="{$item['id']}" order-status="{$item['status']}">关闭</a></p>
							{/if}
							{if $item['status'] ==0 || $item['status'] ==4}
							<p style="color: #428bca;display: inline-block;"><a href="javascript:;" class="js-remove" order-id="{$item['id']}" order-status="{$item['status']}">开启</a></p>
							{/if}
							{if $item['status']==5 && !is_store()}
							<p style="color: #428bca;display: inline-block;"><a href="javascript:;" class="js-pass" order-id="{$item['id']}" flag="1">通过</a> </p>
							<p style="color: #428bca;display: inline-block;"><a href="javascript:;" class="js-pass" order-id="{$item['id']}" flag="0">不通过</a></p>
							{/if}
							<p style="color: #428bca;display: inline-block;"><a href="{php echo web_url('activity/activity_web/delateactivity', array('id'=>$item['id']))}" data-toggle="ajaxRemove" data-confirm="此操作会删除商户活动,该活动对应订单可能会发生错误,确定要删除吗？">删除</a></p>
							{if Customized::init('pft147') > 0}
							<p style="color: #428bca;display: inline-block;"><a href="{php echo web_url('goodshouse/goodshouse/checklist', array('id' => $item['id'],'plugin'=>'activity'))}">核销码</a> </p>
							{/if}
						</td>
					</tr>
					{/loop}
					</tbody>
				</table>
			</div>
		</div>
		{$pager}
	</div>
</div>
<script type="text/javascript">
	$("#search").click(function(){

		$('#form1')[0].submit();
	});
</script>
<script type="text/javascript">
$(function(){
	$('.order-list').delegate('.js-remove', 'click', function(e){
		e.stopPropagation();
		var $this = $(this);
		var id = $this.attr('order-id');
		var status = $this.attr('order-status');
		var statushtml = (status == 0 || status == 4) ? "开启" : "关闭";
		util.nailConfirm(this, function(state) {
			if(!state) return;
			$.post("{php echo web_url('activity/activity_web/changeacstatus')}", {id:id,status:status}, function(data){
				if(!data.errno){
					util.tips(statushtml+"成功！");
					location.reload();
				};
			}, 'json');
		}, {html: "确认<span style='color:red;'>"+statushtml+"</span>？"});
	});

	$('.order-list').delegate('.js-pass', 'click', function(e){
		e.stopPropagation();
		var $this = $(this);
		var id = $this.attr('order-id');
		var flag = $this.attr('flag');
		var statushtml = (flag == 1) ? "通过" : "不通过";
		util.nailConfirm(this, function(state) {
			if(!state) return;
			$.post("{php echo web_url('activity/activity_web/pass')}", {id:id,flag:flag}, function(data){
				if(!data.errno){
					util.tips(statushtml+"成功！");
					location.reload();
				};
			}, 'json');
		}, {html: "确认<span style='color:red;'>"+statushtml+"</span>此活动审核？"});
	});

});
</script>
{php include wl_template('common/footer');}